package code.c13;

/**
 * @author thinkpad - 83start
 * @version v1.0
 * @create 2022/12/2 14:45
 * @package code.c13
 * @description 生产者，消费者问题 - 消费者线程
 */

public class ConsumeThread implements Runnable {
    private WareHouse wareHouse;

    public ConsumeThread(WareHouse wareHouse) {
        this.wareHouse = wareHouse;
    }

    @Override
    public void run() {
        for (int i = 1; i < 10; i++) {
            try {
                Thread.sleep(100);

            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            wareHouse.consume(i);

        }
    }
}
